# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=glibmm

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.40.0
pkgrel=1
pkgdesc="Glib-- (glibmm) is a C++ interface for glib (mingw-w64)"
arch=('any')
url="http://www.gtkmm.org"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-libsigc++" "${MINGW_PACKAGE_PREFIX}-glib2")
options=('staticlibs' 'strip')
source=("http://ftp.gnome.org/pub/GNOME/sources/glibmm/${pkgver%.*}/glibmm-$pkgver.tar.xz"
    fix-conflicted-keyword.patch)
sha256sums=('34f320fad7e0057c63863706caa802ae0051b21523bed91ec33baf8421ca484f'
            '3fec5d8cba064d7090bd55ee8d08c26598833894c1d6f01e5707916e59f201f8')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/fix-conflicted-keyword.patch
}

build() {
  CPPFLAGS+=" -D_REENTRANT"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  "${srcdir}"/${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --enable-shared \
    --disable-documentation
  make -j1
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
}
